{use master_page('admin/v_master')} 
{block content}
<script>
<?php 
	$cu_group = $this->usergroup_manager->get($this->current_user()->usergroup_id);  
?>
$(document).ready(function(){
	$('#type').change(function(){
		var v = $(this).val(); 
		<?
		$get_type = array_remove($_GET, 'type');
		$get_params = Array();
		foreach($_GET as $k=>$v)
		{
			$get_params[] = "$k=$v";
		}
		$get_params_str = implode('&',$get_params);
		?>
		var url = '<?=_U("user/index?")?><?=$get_params_str?>&type=' + v;
		//alert(url);
		//window.open(url);
		window.location.href = url ;  
	}) ;

	$("#chkall").click(function(){
		var checked = $(this).attr("checked");
		$(".datatable tbody input[type=checkbox]").attr("checked",checked) ;  
	}) ; 
	
})
</script>

<div class="line">  
<form id = 'form1' action = '<?=$_SERVER['REQUEST_URI']?>' method='post'>
	<div class="blank5" style="height:10px;"></div>
	<?php if($cu_group->permission("user","edit")):?>
	<div style="padding-left:10px;">
		<input style="width:132px;height:38px;line-height:38px;color:white;background:url(images/btn_03.gif) left top no-repeat;border:none; text-align:center;
 			 cursor: pointer;" class="btn_c" type="button" value=" 添加用户 " 
 			 onclick="javascript:window.location.href='<?=_U("user/edit?tab=system_manager&group_id=").$this->input->get('group-id')?>'">
		<a style="color:red">* 注意:至少保留一个用户，id=1的用户无法删除</a>	
	</div>
	<?php endif;?>
	<div class="blank5" style="height:10px;"></div>
	<div id="tagscontent" class="right_box">
		<table class="datatable" >
			<thead>
				<tr>
					<th >
					<input title="点击可全选本页的所有项目" type="checkbox" id="chkall">
					</th> 
					<th><?=lang('user_name')?></th>
					<th width="48px;"><?=lang('user_nickname')?></th>
					<th width="120px"><?=lang('user_phone')?></th>
					<th width="88px"><?=lang('user_qq')?></th>
					<th width="100px"><?=lang('user_group')?></th>
					<th width="66">操作</th>
				</tr>
			</thead>
		<tbody>
			<?php foreach($users as $user):?>
			<tr> 
				<td style="width:31px;">
					<input type="checkbox" value="<?php echo $user->id;?>"  name="ids[]">
				</td>
				<td align="left"><?=$user->name?></td> 
				<td align="center">{user->nickname}</td>
				<td align="center">{user->phone}</td> 
				<td align="center">{user->qq}</td> 
				<td align="center">{user->group->name}</td> 
				<td>
					<?php if($cu_group->permission("user","edit")):?>
					<a class="edit" onmouseover="tooltip.show('编辑');" onmouseout="tooltip.hide();" href="<?=_U('user/edit?tab=system_manager&id=')?>{user->id}&group_id=<?=!empty($_GET['group-id'])?$this->input->get('class-id'):$user->usergroup_id;?>">
					</a>
					<?php endif;?>
					<?php if($cu_group->permission("user","del")):?>
					<a class="delete"  onmouseover="tooltip.show('删除');" onmouseout="tooltip.hide();" onclick="javascript:return confirm('确认删除');" href="<?=_U('user/del/')?>{user->id}">
					</a> 
					<?php endif?>
				</td>
			</tr>
			<?php endforeach;?>
			<tr>
				<td colspan='7' style="padding:5px 9px;text-align:center">
					<? $this->load->view('admin/v_pager',$sp_config); ?>
				</td>
			</tr>
		</tbody>
	</table>
	</div>
<script>
$(document).ready(function(){
	$('#btn_delete').click(function(){
		var frm = $("#form1");
		frm.attr('action','<?php echo _U("user/del");?>'); 
		frm.submit();
	});
});
</script>
	<div class="blank10" style="height:10px"></div> 
	<?php if($cu_group->permission("user","del")):?> 
	<input class="btn_d" type="button" value=" 删除 " id="btn_delete">
	<?php endif;?>
</form>
</div>
{end} 